
var app = {
    name: 'app',
    version: '1.0.0',
    log: function(arg){
        console.log(arg);
    },
    args: function(ctx){
        return Object.assign(ctx.query,ctx.params,ctx.request.body,ctx.header,ctx.originalUrl)
    },
    md5: function(str){ // https://blog.csdn.net/wail521/article/details/96430873
        var crypto = require('crypto'); 
        return result = crypto.createHash('md5').update(str).digest("hex") 
    },
    checkArgs: function(ctx,arr){
        let args =  Object.assign(ctx.query,ctx.params,ctx.request.body,ctx.header,ctx.originalUrl)
        let flag = false;
        arr.map(e=>{
            if(args[e] == null){
                flag = true;
                ctx.body = { code:0,success:false,msg:e + ' is require ' }
            }
        })        
        return flag;
    },
}
module.exports = app
  